package com.dunqi.gpm.shunqing.home.widget;

import android.app.Dialog;
import android.content.Context;
import android.support.annotation.NonNull;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.DatePicker;

import com.dunqi.gpm.shunqing.R;

/**
 * Created by 空 on 2017/11/30 0030.
 */

public class DatePickerDiaglog extends Dialog {

    private DatePicker datePicker;

    public DatePickerDiaglog(@NonNull Context context) {
        super(context);
        View view = LayoutInflater.from(context)
                .inflate(R.layout.date_picker_view, null);

        setContentView(view);
        datePicker = findViewById(R.id.date_picker);
    }


    public String getTime() {
        int dayOfMonth = datePicker.getDayOfMonth();
        int month = datePicker.getMonth() + 1;
        int year = datePicker.getYear();
        return year + "-" + month + "-" + dayOfMonth;
    }


}
